import type { CSSProperties } from "react";
import type { ButtonProps } from "antd/es/button";
import type { ModalWrapperProps } from "./typing";

export interface ModalPropsType {
	open: boolean;
	scrollTop: boolean;
	height: number;
	minHeight: number;
	// open drag
	draggable: boolean;
	centered: boolean;
	cancelText: string;
	okText: string;
	closeFunc: () => Promise<boolean>;
}

export const ModalPropsDefault = {
	scrollTop: true,
	minHeight: 600,
	// open drag
	draggable: true,
	cancelText: "取消",
	okText: "确认"
};

export interface BasicPropsType extends ModalPropsType {
	defaultFullscreen: boolean;
	// Can it be full screen
	canFullscreen: boolean;
	// After enabling the wrapper, the bottom can be increased in height
	wrapperFooterOffset: number;
	// Warm reminder message
	helpMessage: [string, any[]];
	// Whether to setting wrapper
	useWrapper: boolean;
	loading: boolean;
	loadingTip: string;
	/**
	 * @description: Show close button
	 */
	showCancelBtn: boolean;
	/**
	 * @description: Show confirmation button
	 */
	showOkBtn: boolean;
	wrapperProps: Partial<ModalWrapperProps>;
	afterClose: () => Promise<VueNode>;
	bodyStyle: CSSProperties;
	closable: boolean;
	closeIcon: VueNode;
	confirmLoading: boolean;
	destroyOnClose: boolean;
	footer: VueNode;
	getContainer: () => any;
	mask: boolean;
	maskClosable: boolean;
	keyboard: boolean;
	maskStyle: CSSProperties;
	okType: string;
	okButtonProps: ButtonProps;
	cancelButtonProps: ButtonProps;
	title: string | React.ReactNode;
	open: boolean;
	width: string | number;
	wrapClassName: string;
	zIndex: number;
}

export const BasicPropsDefault = Object.assign({}, ModalPropsDefault, {
	canFullscreen: true,
	wrapperFooterOffset: 0,
	useWrapper: true,
	showCancelBtn: true,
	showOkBtn: true,
	closable: true,
	destroyOnClose: true,
	mask: true,
	maskClosable: true,
	keyboard: true,
	okType: "primary",
	width: "40%"
});

export interface WrapperPropsType {
	loading: boolean;
	useWrapper: boolean;
	modalHeaderHeight: number;
	modalFooterHeight: number;
	minHeight: number;
	height: number;
	footerOffset: number;
	open: boolean;
	fullScreen: boolean;
	loadingTip: string;
}

export const WrapperPropsDefault = {
	useWrapper: true,
	modalHeaderHeight: 57,
	modalFooterHeight: 74,
	minHeight: 200,
	footerOffset: 0
};
